package com.atguigu.eduservice.excel;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.Map;

/**
 * @title: ExcelListener
 * @Author danghailiang
 * @Date: 2022/9/23 21:09
 * @Version 1.0
 */
public class ExcelListener extends AnalysisEventListener<DemoData> {

    /**
     * 一行一行读取数据
     * @param data
     * @param context
     */
    @Override
    public void invoke(DemoData data, AnalysisContext context) {
        System.out.println("******" + data.getName());
    }

    /**
     * 读取表头方法
     * @param headMap
     * @param context
     */
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
//        super.invokeHeadMap(headMap, context);
        System.out.println("表头:" + headMap);
    }

    /**
     * 读取完成之后
     * @param context
     */
    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {

    }
}
